﻿using AutoMapper;
using Himp.TaskScheduling.Datas;
using Himp.TaskScheduling.Tasks;

namespace Himp.TaskScheduling;

public class TaskSchedulingApplicationAutoMapperProfile : Profile
{
    public TaskSchedulingApplicationAutoMapperProfile()
    {
        CreateMap<BizflowConfig, BizflowConfigDto>();
        CreateMap<BizflowConfigCreateDto, BizflowConfig>();
        CreateMap<BizflowConfigUpdateDto, BizflowConfig>();

        CreateMap<BizflowNode, BizflowNodeDto>();
        CreateMap<BizflowNodeCreateDto, BizflowNode>();
        CreateMap<BizflowNodeUpdateDto, BizflowNode>();

        CreateMap<WorkflowModel, WorkflowModelDto>();
        CreateMap<WorkflowTypeStColumnDto, WorkflowTypeStColumn>();
        CreateMap<WorkflowTypeStColumn, WorkflowTypeStColumnDto>();
        CreateMap<WorkflowInstance, WorkflowInstanceDto>();

        CreateMap<WorkflowNodeSFSchema, WorkflowNodeSFSchemaDto>();
        CreateMap<WorkflowNodeSFSchemaDto, WorkflowNodeSFSchema>();
        CreateMap<WorkflowTodoTask, WorkflowTodoTaskDto>();

        CreateMap<SampleObtainTask, SampleObtainTaskDto>();
        CreateMap<WorkflowInstanceStas, WorkflowInstanceStasDto>();

        CreateMap<ParamConfig, ParamConfigDto>();
        CreateMap<ParamConfigCreateOrUpdateDto, ParamConfig>();

        CreateMap<ParamConfigTask, ParamConfigTaskDto>();
        CreateMap<ParamConfigTaskCreateDto, ParamConfigTask>();
        CreateMap<ParamConfigTaskUpdateDto, ParamConfigTask>();

        #region 任务

        CreateMap<SamplePreparationTask, SamplePreparationTaskDto>();
        CreateMap<SamplePreparationResult, SamplePreparationResultDto>();
        CreateMap<SamplePreparationPlanDto, SamplePreparationPlanDto>();

        CreateMap<StandardTestTask, StandardTestTaskDto>();
        CreateMap<StandardTestItem, StandardTestItemDto>();

        CreateMap<SampleTestTask, SampleTestTaskDto>();

        CreateMap<CmDeviceControl, CmDeviceControlDto>()
            .ForMember(dest => dest.Remark, opt => opt.MapFrom(src => src.REMARK))
            .ForMember(dest => dest.Uptime, opt => opt.MapFrom(src => src.UPTIME))
            .ForMember(dest => dest.Totime, opt => opt.MapFrom(src => src.TOTIME))
            .ForMember(dest => dest.Betime, opt => opt.MapFrom(src => src.BETIME))
            .ForMember(dest => dest.Enable, opt => opt.MapFrom(src => src.ENABLE))
            .ForMember(dest => dest.Device, opt => opt.MapFrom(src => src.DEVICE));

        CreateMap<CodeConversion, CodeConversionDto>();

        #endregion

        #region 消息

        CreateMap<EventMsgTopic, EventMsgTopicDto>();
        CreateMap<EventMsgTopicCreateDto, EventMsgTopic>();
        CreateMap<EventMsgTopicUpdateDto, EventMsgTopic>();

        CreateMap<EventMsgRec, EventMsgRecDto>();
        CreateMap<EventMsgRecCreateDto, EventMsgRec>();

        #endregion

        CreateMap<ZYOperateRecord, ZYOperateRecordDto>();
    }
}
